Skip local registry use for vclusters on local kubernetes clusters#2390
Merged
FabianKramm merged 1 commit intodevspace-sh:mainfrom Oct 24, 2022
Merged
Conversation
lizardruss
commented
Oct 21, 2022
Collaborator
Author
lizardruss
left a comment
There was a problem hiding this comment.
@FabianKramm added some additional context to these changes. Let me know if you'd like anything changed.
| isLocalReqistryRequired := !registry.HasPushPermission(imageConf) | ||
| useMinikubeDocker := registry.UseMinikubeDocker(ctx, imageConf) | ||
| if useMinikubeDocker { | ||
| ctx.Log().Warnf("Using Minikube for image %s, skipping local registry", imageConf.Image) |
Collaborator
Author
There was a problem hiding this comment.
We can bring back this edge case if desired, but it was somewhat unexpected to have localRegistry.enabled = true and it still not be used because of minikube.
This did require using a docker client configured for the minikube environment to work, see later comments.
| } | ||
|
|
||
| image, err := daemon.Image(ref, daemon.WithContext(ctx)) | ||
| image, err := daemon.Image(ref, daemon.WithContext(ctx), daemon.WithClient(client.DockerAPIClient())) |
Collaborator
Author
There was a problem hiding this comment.
This update allows the local registry push to work with either the local docker daemon, or the Minikube docker daemon.
| } | ||
|
|
||
| func newDockerClientFromMinikube(ctx context.Context, currentKubeContext string) (Client, error) { | ||
| if currentKubeContext != "minikube" { |
Collaborator
Author
There was a problem hiding this comment.
This would also miss vcluster + Minikube contexts
FabianKramm
approved these changes
Oct 24, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What issue type does this pull request address?
/kind bugfix
What does this pull request do? Which issues does it resolve?
Please provide a short message that should be published in the DevSpace release notes
Fixed an issue where DevSpace local registry was incorrectly used for virtual clusters on local Kubernetes clusters
What else do we need to know?
Previously the local registry could never be used with minikube. These changes allow the user to opt in to the local registry with Minikube, and makes it consistent with the other local kubernetes options (KinD & Docker Desktop). There isn't a practical reason to do this, but using
localRegistry.enabled=truein the config, and not having the local registry used was unexpected to some during testing.There is also a KinD issue where
--force-buildcreates a new tag, butkind load docker-imagefails to re-tag the image in the KinD cluster, leading to anImagePullBackoff. I've verified this issue exists in DevSpace version before the local registry feature was added. Using the local registry works as a workaround for this issue.